package com.chen.bpsptsystem.controller.manger;

import com.chen.bpsptsystem.common.ServerResponse;
import com.chen.bpsptsystem.po.Clazz;
import com.chen.bpsptsystem.service.IClazzService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author chen
 * <p>
 * 兴趣班分类
 */
@RestController
@RequestMapping("/back/clazz/")
public class ClazzController {

    @Resource
    private IClazzService interestService;

    @PostMapping("add")
    public ServerResponse add(@RequestBody Clazz clazz) {
        return interestService.add(clazz);
    }

    @GetMapping("list")
    public ServerResponse list(@RequestParam(value = "pn", name = "pn", defaultValue = "1") Integer pn,
                               @RequestParam(value = "pageSize", name = "pageSize", defaultValue = "10") Integer pageSize,
                               String name) {
        return interestService.list(pn, pageSize, name);
    }

    @PostMapping("delete")
    public ServerResponse delete(Integer id) {
        return interestService.delete(id);
    }

    @PostMapping("edit")
    public ServerResponse edit(@RequestBody Clazz clazz) {
        return interestService.edit(clazz);
    }
}
